#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

class TheNewHouseDivTwo
{
public:
	int count(vector <int> x, vector <int> y)
	{
		xmax = x[0];
		xmin = x[0];
		ymax = y[0];
		ymin = y[0];
		int counter = 0;
		for(int i=1;i<x.size(); i++)
		{
			if(xmax < x[i])
				xmax = x[i];
			if(xmin > x[i])
				xmin = x[i];
		}
		for(int i=1; i<y.size(); i++)
		{
			if(ymax < y[i])
				ymax = y[i];
			if(ymin > y[i])
				ymin = y[i];
		}
		for(int i= xmin; i<=xmax; i++)
		{
			for(int j=ymin; j<=ymax; j++)
			{
				if(check(x, y, i,j) == true)
				{
					counter++;
				}
			}
		}
		return counter;
	}

private:
	int xmax;
	int xmin;
	int ymax;
	int ymin;

	bool check(vector<int> x, vector<int> y, int m, int n)
	{
		bool dir[4] = {false};
		for(int i=0; i<min(x.size(),y.size()); i++)
		{
			if(x[i] == m)
			{
				if(y[i] > n)
					dir[0] = true;
				else if(y[i] < n)
					dir[2] = true;
			}
			else if(y[i] == n)
			{
				if(x[i] > m)
					dir[3] = true;
				else if(x[i] < m)
					dir[1] = true;
			}
		}
		for(int i=0; i<4;i++)
		{
			if(dir[i] == false)
				return false;
		}
		return true;
	}
};